package ly.gupao.edu.designPattern.factory.fac.simple;

import ly.gupao.edu.designPattern.factory.entity.Developer;
import ly.gupao.edu.designPattern.factory.entity.Fronter;
import ly.gupao.edu.designPattern.factory.entity.Javaer;
import ly.gupao.edu.designPattern.factory.entity.Phper;

public class SimpleFactory {

    public Developer getDeveloper(String name){

        //要依靠字符串的匹配去返回对象
        if("java".equals(name)){
            //返回一个java开发者的实例对象
            return new Javaer();
        }else if("php".equals(name)){
            //返回一个php开发者的对象
            return new Phper();
        }else{
            //返回一个前端开发者的对象
            return new Fronter();
        }
    }
}
